#include "mirrorTree.h"
TreeNode* mirrorTree(TreeNode* root)
{
    if (!root)
        return root;
    else
    {

        TreeNode* temp = root->left;
        root->left = mirrorTree(root->right);
        root->right = mirrorTree(temp);
        return root;
    }
}
TreeNode* mirrorTree1(TreeNode* root)
{
    if (!root)
        return root;
    else
    {
        stack<TreeNode*> s;
        TreeNode* current;
        s.push(root);
        while (!s.empty())
        {
            TreeNode* current = s.top();
            s.pop();
            TreeNode* temp = current->left;
            current->left = current->right;
            current->right = temp;
            if (current->left)
                s.push(current->left);
            if (current->right)
                s.push(current->right);
        }

        return root;
    }
}